﻿@model IEnumerable<BlackBox.ActiveGame>
@{
    ViewBag.Title = "ListofActiveGames";
}

<div>
    <p>
        <a href="~/Home/Main">Home</a>
         > 
        <a href="~/Game/PlayGame">Play Game</a>
    </p>
    <h3>List of all active games</h3>
     <table>
            <tr>
			    <th>Name</th>
			    <th>Owner</th>
			    <th>Num Players</th>
                <th>join</th>
		    </tr>
            @foreach(var Game in Model)
            {
		        <tr>
			        <td>@Game.name</td>
			        <td>@Game.owner</td>
			        <td>@Game.numberofplayers / @Game.maxplayers</td>
                    @if (Game.open == true)
                    {
                         <td> <a href="~/Game/Play/@Game.id">Join Game</a> </td>
                    }
                    @if(Game.open == false)
                    {
                        <td>Game is not open</td>
                    }
		        </tr>
            }
	</table>
</div>